Kwik.Page.include("Kwik.Ui.Controls.InputBase.js");
/** 
* Textbox input type
* @constructor
* @base Kwik.Ui.Controls.InputBase
* @requires Kwik.Ui.Utility
* @created 3:26 PM 1/28/2009
* @modified 3:26 PM 1/28/2009
*/
Kwik.Ui.Controls.TextBox = function(config)
{
	/** @ignore */
	this.inheritFrom = Kwik.Ui.Controls.InputBase;
	this.inheritFrom();
	this.__class.push("Kwik.Ui.Controls.TextBox");

	/** Get the current carret position @type Number */
	this.getCarretPosition = function()
	{
		return Kwik.Ui.Utility.getCarretPosition(this.element);
	};

	/** Internal event handler for onconfigure */
	this._configureTextBox = function(config)
	{

	};

	/** Internal event handler for onload events */
	this._loadTextBox = function(element)
	{
		Kwik.Page.log.write("Kwik.Ui.Controls.TextBox._loadTextBox: Loading from page.");
		if(element.nodeName.toLowerCase() != "input")
		{
			Kwik.Page.log.write("Kwik.Ui.Controls.TextBox._loadTextBox: Wrong element type, replacing element.");
			var newElement = document.createElement("input");
			Kwik.Ui.Utility.copyAttributes(element, newElement);
			element.parentNode.replaceChild(newElement, element)
			this.setElement(newElement);
		}
		if(!this.element.type || this.element.type.toLowerCase() != "text"){this.element.type = "text";}
	};
	
	/** @ignore */
	this.main = function(config)
	{
		this.attachEvent("onconfigure", this._configureTextBox);
		this.attachEvent("onload", this._loadTextBox);
		if(config){this.configure(config);}
	}; this.main(config);
}